package com.iman.Confucius.web;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.iman.common.util.ConfigUtil;

@Controller
@RequestMapping(value="/jsp/*")
public class HomePageInitController {
	
	// 其他的页面模仿我的请求，  返回 "email_suc";  就能显示 jsp页面
	@RequestMapping(value="/init")
	public String initjsp(){
		return "email_suc";
	}
	
	// 其他的页面模仿我的请求，  返回 "email_suc";  就能显示 jsp页面
	@RequestMapping(value="/init2")
	public ModelAndView initjspParamter(HttpServletRequest request){
	 //图片的域名  	   
	 String imgbasePath  =ConfigUtil.getString( "image.server" );; 
	 //css 服务器连接    在 context.properties 配置
	 String cssbasePath  =ConfigUtil.getString( "css.server" );; 
			
		
		Map model = new HashMap();
		model.put("user", "测试传递变量" );
		model.put("imgpath", imgbasePath );
		model.put("csspath", cssbasePath );
		ModelAndView view =null;
		if(  1>8){
			view = new ModelAndView("email_suc",model);
		}else {
			view = new ModelAndView("testemail_suc",model);
		}
		return view;
	}
	
	/**
	 * 
	 * image.server = http://127.0.0.1:808/

css.server =  http://127.0.0.1:808/
	 * 
	 * 
	 * 
	 * @return
	 */
	
	
	//这个是 输入 freemarker 的模板例子
	@RequestMapping(value="/initftl")
	public String initftl(){
		return "email_sucftl";
	}
	
	
	//这个是 输入 freemarker 的模板例子
	@RequestMapping(value="/initftl2")
	public ModelAndView initftlParamter(HttpServletRequest request){
		   
		 String imgbasePath  =ConfigUtil.getString( "image.server" );; 
		 String cssbasePath  =ConfigUtil.getString( "css.server" );; 
				
			
			Map model = new HashMap();
			model.put("user", "测试传递变量" );
			model.put("imgpath", imgbasePath );
			model.put("csspath", cssbasePath );
		ModelAndView view =null;
		if(  1>8){
			 
				view = new ModelAndView("testemail_sucftl",model);
			 
		}else {
			view = new ModelAndView("testemail_sucftl",model);
		}
		return view;
		 
	}
	
}
